<ui:composition xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:p="http://primefaces.org/ui"
	template="template.xhtml">
	
	<ui:define name="head">
		<style type="text/css">
			.label {
				width:15%;
				padding:1px;
			}

			.value {
				width:20%;
				padding:1px;
			}
			.icon {
				width:70%;
				padding:1px;
			}
			.grid {
				width:100%;
			}
		</style>
	</ui:define>
	
  <ui:define name="content">
		
		<h:form prependId="false">
			
			<p:panel id="panel" header="Modify new Driver">
				<!--<p:growl showDetail="true"/>
				--><p:messages id="msgs" showDetail="true"/> 
				<h:panelGrid columns="3" columnClasses="label,value,icon" styleClass="grid">
					<h:outputLabel for="title" value="Driver DL NO:" />
					<p:inputText id="title" value="#{createDriver.driver.driverDlNo}" required="true"
					 requiredMessage="Driver DL is mandatory" validatorMessage="Max length is 30">
						<f:validateLength maximum="30" />
					</p:inputText>
					<p:message for="title" display="icon"/> 
					
					<h:outputLabel for="driverName" value="Driver Name:" />
					<p:inputText id="driverName" value="#{createDriver.driver.driverName}" required="true"
					 requiredMessage="Driver Name is mandatory">
					</p:inputText>
					<p:message for="driverName" display="icon"/> 
					
					<h:outputLabel for="driverMobileNo" value="Mobile No:" />
					<p:inputText id="driverMobileNo" value="#{createDriver.driver.driverMobileNo}" required="true"
					 requiredMessage="Driver Mobile is mandatory"  converterMessage="Only numbers dude" validatorMessage="Max length is 10">
						<f:validateLength maximum="10" />
					</p:inputText>
					<p:message for="driverMobileNo" display="icon"/>
					
					<h:outputLabel for="driverDLExpDate" value="DL EXPIRY DATE:" />
					<p:calendar id="driverDLExpDate" value="#{createDriver.driver.driverDlExpDate}" 
					required="true"
					 requiredMessage="DL Exp date is mandatory" 
					showOn="button" pattern="EEE, dd MMM, yyyy" showButtonPanel="true" navigator="true"/> 
					<p:message for="driverDLExpDate" display="icon"/>
					
					
					<h:outputLabel for="address" value="Address" />
					<h:inputTextarea id="address" value="#{createDriver.driver.driverAddress}" cols="18" rows="4" validatorMessage="Max length is 125">
						<f:validateLength maximum="125" />
					</h:inputTextarea>
					<p:message for="address" display="icon"/>
					
					<h:outputText />
					<h:panelGroup>
						<h:panelGrid columns="2">
							<p:commandButton value="Reset" type="reset" />
							<p:commandButton value="Save" actionListener="#{createDriver.save}" async="true" update="panel" >
								<p:confirmDialog yesLabel="Just save it" noLabel="Hmm, nope" 
									message="Seriously dude, are you sure?" 
									header="Confirm :)" severity="warn" fixedCenter="true" draggable="false"/>
							</p:commandButton>
						</h:panelGrid>
					</h:panelGroup>
					
				</h:panelGrid>
			</p:panel>

		</h:form>
		
  </ui:define>
  
</ui:composition>